class Solution(object):
    def maxScore(self, s):
        n = len(s)
        p1 = [0] * (n + 1)
        p2 = [0] * (n + 1)
        for i in range(n):
            p1[i + 1] = p1[i] + (s[i] == '0')
            p2[n - 1 - i] = p2[n - i] + (s[n - 1 - i] == '1')
        mav = 0
        for i in range(1, n):
            mav = max(mav, p1[i] + p2[i])
        return mav


data = Solution()
s = '00'
print(data.maxScore(s))
